/**
 * CellSoft 2010
 */
package com.reportgear.designer.i18n;

import java.util.Enumeration;
import java.util.ResourceBundle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 设计器国际化
 * 
 * @version 1.0 2011-3-14
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 * 
 */
class I18N {
	private static final Logger logger = LoggerFactory.getLogger(I18N.class.getName());
	private static ResourceBundle fr;

	public I18N() {
	}

	public static String getLocText(String key) {
		return fr.getString(key);
	}

	static {
		try {
			fr = ResourceBundle.getBundle("com/anncsr/designer/i18n/designer");
		} catch (Throwable ex) {
			logger.warn(ex.getMessage());
			fr = new ResourceBundle() {

				protected Object handleGetObject(String key) {
					return key;
				}

				public Enumeration<String> getKeys() {
					return new Enumeration<String>() {

						public boolean hasMoreElements() {
							return false;
						}

						public String nextElement() {
							return null;
						}
					};
				}
			};
		}
	}
}
